﻿using System;
using System.Windows;

namespace HomeController
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            var controllerViewModel = new ControllerViewModel();
            this.DataContext = controllerViewModel;
            InitializeComponent();

            transition.Transition = new Telerik.Windows.Controls.TransitionEffects.PerspectiveRotationTransition();
        }

        private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            var usersWindow = new UsersWindow(this);

            transition.Content = usersWindow;
        }

        private void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ((ControllerViewModel)this.DataContext).CloseControler();
        }

        private void UsbClick(object sender, RoutedEventArgs e)
        {
            ((ControllerViewModel)this.DataContext).InitializationHardware();
        }

        private void RefreshMe(object sender, RoutedEventArgs e)
        {
            ((ControllerViewModel)this.DataContext).UpdateMySelf(null,null);
        }
    }
}